<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    table {
        width: 600px;
        margin: 100px auto;
    }

    table,
    tr,
    td {
        border: 1px solid black;
        border-collapse: collapse;
        text-align: center;
    }

    .hhh {
        height: 80px;
    }

    tr {
        height: 40px;
    }

    tr:nth-child(1) {
        background-color: #f5f5f5;
    }
</style>

<body>
    <table>
        <tr>
            <td>编号</td>
            <td>编号</td>
            <td>成绩</td>
            <td>操作</td>

        </tr>
        <script>
            let data = [
                { subject: '语文', score: 46 },
                { subject: '数学', score: 80 },
                { subject: '英语', score: 100 },
            ]

            for (let i = 0; i < data.length; i++) {
                document.write(`
            <tr>
                    <td>${i + 1}</td>
                    <td>${data[i].subject}</td>
                    <td>${data[i].score}</td>
                    <td> <a href="#">删除</a></td>
             </tr>
            `)
            }
        </script>
        <tr class="hhh">
            <td colspan="4"> 暂无数据</td>
        </tr>

        <script>
            let data1 = [
                { subject: '语文', score: 46 },
                { subject: '数学', score: 80 },
                { subject: '英语', score: 100 },
            ]
            let sum = 0

            for (let i = 0; i < data1.length; i++) {

                sum += data1[i].score
            }
            let re = sum / data1.length
            document.write(` <td colspan="4">
                总分：${sum} 平均分：${re}
            </td> `)
        </script>


    </table>

</body>

</html>